package com.android.clinic.doctors.app.http.exception;

/**
 * Created by cheng on 2018/6/19.
 */
public enum ExceptionEnum {

    CONNECT_ERROR("网络连接失败，请检查网络", 0x01),
    CONNECT_TIMEOUT("连接超时，请稍后再试", 0x012),
    BAD_NETWORK("服务器异常", 0x03),
    PARSE_ERROR("解析服务器数据失败", 0x04),
    UNKNOWN_ERROR("网络异常，请稍后重试", 0x05);

    // 成员变量
    private String message;
    private int value;

    // 构造方法
    ExceptionEnum(String message, int value) {
        this.message = message;
        this.value = value;
    }

    // 普通方法
    public static String getMessage(int value) {
        for (ExceptionEnum c : ExceptionEnum.values()) {
            if (c.getValue() == value) {
                return c.message;
            }
        }
        return null;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public int getValue() {
        return value;
    }

    public void setValue(int value) {
        this.value = value;
    }

}
